package net.pws.oos.biz.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import net.pws.oos.biz.model.Dict;
import net.pws.oos.biz.service.DictService;

@Service
@Transactional
public class DefaultDictService extends AbstractService implements DictService {
    
    @Override
    public Dict save(Dict dict) {
        entityManager.persist(dict);
        return dict;
    }
    
    @Override
    public void delete(String id) {
        Dict dict = entityManager.find(Dict.class, id);
        if (dict == null) {
            return;
        }
        
        dict.setDeleted(Boolean.TRUE);
        dict.setName(dict.getName() + "|已删除");
        save(dict);
    }
    
}
